package com.scalar.chiptrack.operations.tapereel.actioncommands;

import com.scalar.chiptrack.actioncommands.ActionCommand;
import com.scalar.chiptrack.commons.Constants;

/**
 * Created by IntelliJ IDEA.
 * User: Sudhakar
 * Date: Apr 16, 2007
 * Time: 6:21:06 PM
 */
public class TapeReelRequestCommandFactory implements Constants
{

    private static TapeReelRequestCommandFactory tapeReelRequest;

    public synchronized static TapeReelRequestCommandFactory getInstance()
    {
        if (tapeReelRequest == null) {
            tapeReelRequest = new TapeReelRequestCommandFactory();
        }
        return tapeReelRequest;
    }

    private TapeReelRequestCommandFactory()
    {
    }

    /**
     * Returns the ActionCommand Class that implements businnes logic for the given action
     *
     * @param action
     * @return ActionCommand
     */
    public static ActionCommand getActionCommand(String action)
    {
        ActionCommand command = null;

        if (action == null || ACTION_SEARCH.equalsIgnoreCase(action))
        {
            command = new TapeReelRequestSearchCommand();
        }
        if( ACTION_NEW.equalsIgnoreCase( action ) )
        {
            command = new TapeReelRequestNewCommand();
        }
        if( ACTION_CREATE.equalsIgnoreCase( action ) )
        {
            command = new TapeReelRequestCreateCommand();
        }
        if( ACTION_SAVE.equalsIgnoreCase( action ) )
        {
            command = new TapeReelRequestSaveCommand();
        }
        if( ACTION_EDIT.equalsIgnoreCase( action ) )
        {
            command = new TapeReelRequestEditCommand();
        }
        if( ACTION_MODIFY.equalsIgnoreCase( action ) )
        {
            command = new TapeReelRequestModifyCommand();
        }
         if( ACTION_CONFIRM.equalsIgnoreCase( action ) )
        {
            command = new TapeReelRequestConfirmCommand();
        }
        if( ACTION_VIEW.equalsIgnoreCase( action ) )
        {
            command = new TapeReelRequestViewCommand();
        }
        if( ACTION_CANCEL.equalsIgnoreCase( action ) )
        {
            command = new TapeReelRequestCancelCommand();
        }
        if( ACTION_CLOSE.equalsIgnoreCase( action ) )
        {
            command = new TapeReelRequestCloseCommand();
        }

        return command;
    }
}
